#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<unordered_map>
 
using namespace std;

class addition
{
public:
	vector<int> myfind(vector<int>& nums, int target)
	{
		unordered_map<int, int> nums_map;
		int n = nums.size();
		int i = 0;
		for (i = 0; i < n; i++)
		{
			int cha = target - nums[i];
			if (nums_map.find(cha) != nums_map.end())
			{
				return { nums_map[cha],i };
			}
			nums_map.insert({ nums[i],i });
		}
		return {};
	}

};

int main()
{
	addition ad;
	vector<int> nums;
	int i,n = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		int num;
		cin >> num;
		nums.push_back(num);
	}
	int target = 0;
	cin >> target;
	vector<int> stu = ad.myfind(nums, target);
	cout << "[" << stu[0] << "," << stu[1] << "]" << endl;
	return 0;
}